package com.song.cmsservice.controller;



import com.song.cmsservice.client.IndexFeign;
import com.song.cmsservice.entity.CrmBanner;
import com.song.cmsservice.service.CrmBannerService;
import com.song.commonutils.ResultObj;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 首页banner表 前端控制器
 * </p>
 *
 * @author song
 * @since 2020-04-03
 */
@RestController
@RequestMapping("/eduservice/bannerfrout")
@Api(description = "前台轮播图")
public class BannerFroutController {

    @Autowired
    private CrmBannerService crmBannerService;

    @Autowired
    private IndexFeign indexFeign;

    /**
     * 查询所有轮播图
     * @return
     */
    @ApiOperation(value = "查询所有轮播图")
    @GetMapping("/")
    public ResultObj findAll() {
        List<CrmBanner> list = crmBannerService.selectBanner();
        return ResultObj.ok().data("data",list);
    }



    /**
     * 查询前8条热门课程
     *
     * @return
     */

    @ApiOperation(value = "查询前8条热门课程")
    @GetMapping("/index")
    public Object index() {
        return indexFeign.index();
    }

    /**
     * 查询前4名师
     * @return
     */
    @ApiOperation(value = "查询前4名师")
    @GetMapping("/indexTeacher")
    public Object indexTeacher() {

        return indexFeign.indexTeacher();
    }
}

